package com.aspose.cells;

import java.util.ArrayList;

class zaxi extends zawf {
   private zahn[] a;
   private int[] b;
   private int c = -2;
   private int d = -2;
   private int e = -1;

   public zaxi(zzw var1, zaay var2, boolean var3) {
      ArrayList var4 = new ArrayList();
      this.a(var1.m(), var2, var4, var3);
      this.a(var1.n(), var2, var4, var3);
      if (var4.size() > 0) {
         int var5 = 0;
         this.a = new zahn[var4.size()];
         this.b = new int[this.a.length];

         for(int var6 = 0; var6 < this.a.length; ++var6) {
            this.a[var6] = (zahn)var4.get(var6);
            var5 += this.a[var6].e();
            this.b[var6] = var5;
         }
      } else {
         this.a = null;
         this.b = null;
         this.d = -1;
         this.c = -1;
      }

   }

   zaxi(zaxi var1, zaay var2) {
      this.a = new zahn[var1.a.length];

      for(int var3 = 0; var3 < this.a.length; ++var3) {
         this.a[var3] = var1.a[var3].b(var2);
      }

      this.b = var1.b;
      this.c = var1.c;
      this.d = var1.d;
      this.e = var1.e;
   }

   public zahn b(zaay var1) {
      return new zaxi(this, var1);
   }

   public int c() {
      return this.b == null ? 0 : this.b[this.b.length - 1];
   }

   public int d() {
      return 1;
   }

   public int e() {
      return this.c();
   }

   public boolean l() {
      return this.c() < 2;
   }

   public boolean m() {
      return this.c() < 2;
   }

   public boolean n() {
      return true;
   }

   public zagu a(int var1, int var2) {
      if (this.b == null) {
         return null;
      } else if (this.b.length == 1 && this.b[0] == 1) {
         return this.a[0].a(0, 0);
      } else {
         for(int var3 = 0; var3 < this.b.length; ++var3) {
            if (var1 < this.b[var3]) {
               int var4 = var3 > 0 ? var1 - this.b[var3 - 1] : var1;
               return this.a[var3].a(var4 / this.a[var3].d(), var4 % this.a[var3].d());
            }
         }

         return null;
      }
   }

   public int b() {
      return 5;
   }

   public void f() {
      if (this.a != null) {
         this.e = 0;
         this.a[0].f();
      }
   }

   public boolean b(int var1, int var2) {
      if (var2 > 0) {
         ++var1;
      }

      return this.a(var1);
   }

   public boolean a(int var1) {
      for(int var2 = 0; var2 < this.b.length; ++var2) {
         if (var1 < this.b[var2]) {
            int var3 = var2 > 0 ? var1 - this.b[var2 - 1] : var1;
            this.a[var2].f();
            return this.a[var2].b(var3 / this.a[var2].d(), var3 % this.a[var2].d());
         }
      }

      return false;
   }

   public boolean g() {
      if (this.e < 0) {
         return false;
      } else if (this.a[this.e].g()) {
         return true;
      } else {
         ++this.e;
         if (this.e < this.a.length) {
            this.a[this.e].f();
            if (this.a[this.e].g()) {
               return true;
            }

            while(true) {
               ++this.e;
               if (this.e >= this.a.length) {
                  break;
               }

               this.a[this.e].f();
               if (this.a[this.e].g()) {
                  return true;
               }
            }
         }

         this.e = -1;
         return false;
      }
   }

   public zagu h() {
      return this.e < 0 ? null : this.a[this.e].h();
   }

   public int i() {
      if (this.e < 0) {
         return -1;
      } else {
         int var1 = this.a[this.e].i() * this.a[this.e].d() + this.a[this.e].j();
         return this.e > 0 ? this.b[this.e - 1] + var1 : var1;
      }
   }

   public int j() {
      return 0;
   }

   public int k() {
      return this.i();
   }

   public zahn b(int var1) {
      return new zaya(this.a(var1, 0));
   }

   public zahn c(int var1) {
      return this;
   }

   public boolean a() {
      for(int var1 = 0; var1 < this.a.length; ++var1) {
         if (!this.a[var1].a()) {
            return false;
         }
      }

      return true;
   }

   public void a(boolean var1) {
      for(int var2 = 0; var2 < this.a.length; ++var2) {
         this.a[var2].a(var1);
      }

   }

   public boolean q() {
      return this.c > -2;
   }

   public int s() {
      if (this.c < -1) {
         this.C();
      }

      return this.c;
   }

   public int r() {
      if (this.d < -1) {
         this.C();
      }

      return this.d;
   }

   public int u() {
      return 0;
   }

   public int t() {
      return 0;
   }

   private void C() {
      for(int var2 = 0; var2 < this.a.length; ++var2) {
         zahn var1 = this.a[var2];
         this.d = var1.r();
         if (this.d > -1) {
            var1.b(this.d, 0);
            this.d = this.d * var1.d() + var1.j();
            if (var2 > 0) {
               this.d += this.b[var2 - 1];
            }

            if (var2 < this.a.length - 1) {
               for(int var3 = this.a.length - 1; var3 > var2; --var3) {
                  var1 = this.a[var3];
                  this.c = var1.s();
                  if (this.c > -1) {
                     this.c *= var1.d();
                     this.c += var1.u() + this.b[var3 - 1];
                     return;
                  }
               }

               var1 = this.a[var2];
            }

            this.c = this.d + var1.u() - var1.j();
            return;
         }
      }

      this.d = -1;
      this.c = -1;
   }

   private void a(zagu var1, zaay var2, ArrayList var3, boolean var4) {
      if (var1 != null) {
         if (var1.a() == 16) {
            zzw var5 = (zzw)var1;
            this.a(var5.m(), var2, var3, var4);
            this.a(var5.n(), var2, var3, var4);
         } else {
            zahn var6 = var1.a(var2, var4);
            if (var6.e() > 0) {
               com.aspose.cells.b.a.a.ze.a(var3, (Object)var6);
            }
         }
      }

   }
}
